package kaug.loeng2;

/**
 * Abstract class Shape. Every 
 * shape we use will inherit from
 * this class.
 * @author Ago
 *
 */
public abstract class Shape {
	
	/**
	 * Static variable to count
	 * the total number of shapes
	 * in our program.
	 */
	public static int shapeCount = 0;
	
	/**
	 * Every shape has a color.
	 * All the subclasses have
	 * the properties of Shape.
	 */
	String color = "black";
	
	/**
	 * Every shape should implement
	 * method "draw()". Here we use
	 * "abstract" keyword to indicate
	 * an abstract method, which does
	 * not have body (notice the missing
	 * { and } ).
	 * <p>
	 * Every class which extends Shape, 
	 * has to implement all the abstract
	 * methods defined.
	 */
	public abstract void draw();
	
	/**
	 * Constructor, which counts shapes.
	 */
	public Shape() {
		shapeCount++;
	}

	/**
	 * Sets color for the given shape.
	 * Every subclass can use this method.
	 * If called for example for line (
	 * line.setColor("black");
	 * ),
	 * this method here will be executed. 
	 * @param c Color name
	 */
	public void setColor(String c) {
		color = c;
		// draw object with new color
		draw();
	}
}
